#include "GameRectangle.h"
#include <math.h>
#define Theta 0.1

GameRectangle::GameRectangle(Vector2D &tR,Vector2D &bL):BL(bL),TR(tR)
{
}
GameRectangle::GameRectangle(Vector2D &center,double & rayon):TR(Vector2D(center.X+rayon,center.Y-rayon)),BL(Vector2D(center.X-rayon,center.Y+rayon))
{
}

GameRectangle::~GameRectangle(void)
{
}
int GameRectangle::collisionRectExt(GameRectangle & rect)
{
	if(TR.X < rect.BL.X || BL.X > rect.TR.X || TR.Y > rect.BL.Y || BL.Y < rect.TR.Y)
		return 0;
	return 9;
}
int GameRectangle::collisionRectInt(GameRectangle & rect)
{
	if(TR.X <= rect.TR.X)
	{
		if(TR.Y >= rect.TR.Y)
			return 5;
		if(BL.Y <= rect.BL.Y)
			return 6;
		return 1;
	}
	if(BL.X >=rect.BL.X )
	{
		if(TR.Y >= rect.TR.Y)
			return 7;
		if(BL.Y <= rect.BL.Y)
			return 8;
		return 2;
	}
	if(TR.Y >= rect.TR.Y)
		return 3;
	if(BL.Y <= rect.BL.Y)
		return 4;
	return 0;
}
Vector2D GameRectangle::GetCentre()
{
	return (TR+BL)*0.5;
}